#include"comm.hpp"
#include<string.h>
#include"fifo.hpp"
int main()
{

    //std::cout << x_16(k) << std::endl;
    s.test1();//创建地址空间
    s.Shmat();//挂接

    gpipe.openread();
    
    s.shmmete();
    //char* ret = (char*)s.Ret();
    //printf("虚拟地址空间:%p",ret);
    struct data* add = (struct data*)s.Ret();
    //这里通过地址空间通信
    while(true)
    {
        gpipe.Wait();
        std::cout << "status:" << add->status << std::endl;
        std::cout << "lasttime:" << add->lasttime << std::endl;
        std::cout << "imge:" << add->imge << std::endl;
        strcpy(add->status,"过期");
        sleep(2);
        //printf("获取的数据:%s\n",ret);
    }
    s.Shmdt();//去关联

    sleep(5);
    s.SHmctl();//删除
    return 0;
}